﻿@{
    ViewBag.Title = "QL Nhan vien";
}

<script>
    function ChangeCode() {
        var keys = $("#user-search-key").val();
        var roleId = $("#RolesID").val();
        $.get("/UserManagement/List?keys=" + keys + "&roleId=" + roleId + "&page=" + 1, function (data) {
            $(".listuser").html("");
            $(".listuser").html(data);
        });
    };
</script>

<div class="row-fluid">
    <div class="span3">
        <a class="btn" href="@Url.Action("Add", "UserManagement", new { })">
            <span>Thêm mới</span>
        </a>
    </div>
    <div class="span6"><input id="user-search-key" type="text" name="keys" placeholder="Nhập từ khóa tìm kiếm" style="width:calc(100% - 14px);" /></div>
    <div class="span3">@Html.DropDownList("ListRoles", null, new { id = "RolesID", onchange = "ChangeCode()", @class = "select2-container", @style = "width:100%;" })</div>
</div>

<div class="head">
    <div class="isw-grid"></div>
    <h1>Quản lý nhân viên</h1>
    <div class="clear"></div>
</div>
<div class="block-fluid table-sorting">
    <div class="row-fluid listuser">
        @Html.Action("List", "UserManagement", new { keys = "", roleId = 0, page = 1 })
    </div>
</div>

<script>
    (function ($) {
        $("#user-search-key").keyup(function (e) {
            if (e.keyCode == 13) {
                var keys = $("#user-search-key").val();
                var roleId = $("#RolesID").val();
                $.get("/UserManagement/List?keys=" + keys + "&roleId=" + roleId + "&page=" + 1, function (data) {
                    $(".listuser").html("");
                    $(".listuser").html(data);
                });
            }
        })
    })(jQuery)
</script>
